import { Layout, Typography, Space } from 'antd';
import { history } from 'umi';

const Index = () => {
  const exit = (): void => {
    history.push('/login');
  };

  const name = localStorage.getItem('username');

  return (
    <Layout.Header
      className="site-layout-background"
      style={{
        padding: '0 20px',
        borderBottom: '1px solid red',
        textAlign: 'right',
      }}
    >
      <Space>
        <Typography.Text>欢迎你，{name}</Typography.Text>
        <Typography.Link onClick={exit}>退出</Typography.Link>
      </Space>
    </Layout.Header>
  );
};

export default Index;
